package online.flowerinsnow.minecraft.bukkit.testffa.event;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
 * 当玩家击杀玩家时触发
 */
public class PlayerKillEvent extends Event implements Cancellable {
    @NotNull public static final HandlerList HANDLER_LIST = new HandlerList();

    /**
     * 击杀的玩家
     */
    @NotNull public final Player killer;
    /**
     * 被击杀的玩家
     */
    @NotNull public final Player playerKilled;

    public boolean cancelled;

    public PlayerKillEvent(@NotNull Player killer, @NotNull Player playerKilled) {
        this.killer = killer;
        this.playerKilled = playerKilled;
    }

    @Override
    public HandlerList getHandlers() {
        return HANDLER_LIST;
    }
    public static @NotNull HandlerList getHandlerList() {
        return HANDLER_LIST;
    }

    @Override
    public boolean isCancelled() {
        return cancelled;
    }

    @Override
    public void setCancelled(boolean b) {
        this.cancelled = b;
    }
}
